package com.snail.readyvr.util;

import android.app.Activity;
import android.view.View;

import com.github.topbottomsnackbar.TBSnackbar;
import com.snail.readyvr.R;

/**
 * Created by MRKING on 2016/10/24.
 */

public class TBSnackBarUtils {
    private TBSnackBarUtils(){}

    public static void showShort(Activity activity,String resource){
        show(activity,resource, TBSnackbar.LENGTH_SHORT, R.color.indicator_title_selected_color,TBSnackbar.STYLE_SHOW_TOP_FITSYSTEMWINDOW);
    }

    public static void showShort(Activity activity,int resId){
        showShort(activity,activity.getString(resId));
    }
    public static void showLong(Activity activity,int resId){
        showLong(activity,activity.getString(resId));
    }

    public static void showLong(Activity activity,String resource){
        show(activity,resource, TBSnackbar.LENGTH_LONG, R.color.indicator_title_selected_color,TBSnackbar.STYLE_SHOW_TOP_FITSYSTEMWINDOW);
    }

    public static void show(Activity activity,String resource,int duration,int colorRes,int style){
        TBSnackbar snack = TBSnackbar.make(activity.getWindow().getDecorView(), resource, duration,style);

        View view = snack.getView();
        view.setBackgroundResource(colorRes);

        snack.show();
    }
}
